package training;

import java.util.Arrays;
import java.util.Scanner;

public class Day2_01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        StringBuilder sb = new StringBuilder();
        String[] strings = string.split(" ");
        for(int i = strings.length - 1; i >= 0; i--){
            sb.append(strings[i]);
            if(i != 0) {
                sb.append(" ");
            }
        }
        System.out.println(sb.toString());
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        int i = 0;
        char[] chars = string.toCharArray();
        reverse(chars, 0, chars.length-1);
        System.out.println(new String(chars));
        while (i < string.length()){
            int j = i + 1;
            while (j < string.length() && chars[j] != ' '){
                j++;
            }
            if(j < string.length()){
                reverse(chars, i, j-1);
                i = j + 1;
            } else {
                reverse(chars, i, j-1);
                i = j;
            }
        }
        System.out.println(new String(chars));
    }
    public static void reverse(char[] arr, int start, int end){
        while (start < end){
            char temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
            start++;
            end--;
        }
    }
}
